package com.bindapp.model;

import android.content.Context;
import android.databinding.DataBindingUtil;
import android.view.LayoutInflater;
import android.view.View;

import com.bindapp.R;
import com.bindapp.databinding.ActivityAboutBinding;

/**
 * Created by apple on 2018/7/21.
 */

public class AboutUsModel extends BaseModel {
    private ActivityAboutBinding binding;
    private int currentPosition=0;
    public AboutUsModel(Context context){
        super(context);
        binding= DataBindingUtil.inflate(LayoutInflater.from(context), R.layout.activity_about,null,false);
        binding.setClick(new ViewClick());
        binding.label3.setTag(0);
    }

    @Override
    public ActivityAboutBinding getBinding() {
        return binding;
    }

    public class ViewClick{
        public void onClick(View view){
            switch (view.getId()){
                case R.id.rightbtn:
                    /*currentPosition+=20;
                    if(currentPosition>=binding.rylayout.getMeasuredWidth()){
                        currentPosition=binding.rylayout.getMeasuredWidth();
                    }

                    binding.rylayout.smoothScrollTo(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,currentPosition),0);*/
                    break;
                case R.id.leftbtn:
                    /*currentPosition-=20;
                    if(currentPosition<0){
                        currentPosition=0;
                    }

                    binding.rylayout.smoothScrollTo(currentPosition,0);*/
                    break;
                case R.id.label3:
                    if(((int)binding.label3.getTag())==0){
                        binding.label3.setTag(1);
                        binding.label3.setText(context.getString(R.string.about2));
                    }else{
                        binding.label3.setTag(0);
                        binding.label3.setText(context.getString(R.string.about1));
                    }

                    break;
            }
        }
    }
}
